<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/4/23
  Time: 11:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta property="lang" content="zh_CN">
    <title>言曌博客 | 个人资料</title>
    <link rel="shortcut icon" type="images/x-icon" href="/upload/2018/10/logo20181111185335360.png">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/pace.min.css">
    <link rel="stylesheet" href="css/adminlte.min.css">
    <link rel="stylesheet" href="css/_all-skins.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/loader.css">
    <link rel="stylesheet" href="css/jquery.toast.min.css">
    <link rel="stylesheet" href="css/fileinput.min.css">
    <link rel="stylesheet" href="css/owo.min.css">
    <link rel="stylesheet" href="css/pretty-checkbox.min.css">
    <!--[if lt IE 9]>
    <script src="js/html5shiv.min.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/owo.min.js"></script>
</head>
<body class="hold-transition sidebar-mini fixed skin-blue ">
<div class="wrapper">
    <!-- 顶部栏模块 -->
    <header class="main-header">
        <a href="/admin" class="logo">
            <span class="logo-mini"><b>S</b>S</span>
            <span class="logo-lg"><b>SE</b>NS</span>
        </a>
        <nav class="navbar navbar-static-top" role="navigation">
            <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
                <span class="sr-only">Toggle navigation</span>
            </a>
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li><a href="/" title="跳转到前台" target="_blank"><i class="fa fa-location-arrow"></i></a></li>
                    <li class="dropdown messages-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="fa fa-bell-o"></i>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="header">
                                你有 0 条新评论
                            </li>
                            <li>
                                <ul class="menu">
                                </ul>
                            </li>
                            <li class="footer"><a href="/admin/comment?status=1">查看所有评论</a></li>
                        </ul>
                    </li>
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="picture/1927d92e4aa543c8a2c764b6d096c335.gif" class="user-image" alt="User Image">
                            <span class="hidden-xs">xhz199838</span>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="user-header">
                                <img src="picture/1927d92e4aa543c8a2c764b6d096c335.gif" class="img-circle"
                                     alt="User Image">
                                <p>xhz199838</p>
                            </li>
                            <li class="user-footer">
                                <div class="pull-left"><a data-pjax="true" href="/admin/user/profile"
                                                          class="btn btn-default "><i class="fa fa-user"></i>个人资料</a>
                                </div>
                                <div class="pull-right"><a href="/admin/logOut" class="btn btn-default "><i
                                        class="fa fa-sign-out"></i>退出登录</a></div>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <!-- 菜单栏模块 -->
    <aside class="main-sidebar">
        <section class="sidebar">
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="picture/1927d92e4aa543c8a2c764b6d096c335.gif" class="img-circle"
                         style="width: 45px;height: 45px;" alt="User Image">
                </div>
                <div class="pull-left info">
                    <p>xhz199838</p>
                    <a href="/admin/user/profile"><i
                            class="fa fa-circle text-success"></i>个人资料</a>
                </div>
            </div>
            <form action="/search" method="get" target="_blank" class="sidebar-form">
                <div class="input-group">
                    <input type="text" name="keyword" class="form-control" placeholder="Search...">
                    <span class="input-group-btn">
<button type="submit" name="keyword" id="search-btn" target="_blank" class="btn btn-flat">
<i class="fa fa-search"></i>
</button>
</span>
                </div>
            </form>
            <!--左侧菜单栏-->
            <ul class="sidebar-menu tree" data-widget="tree">
                <li class="header">HEADER</li>
                <li class="active"><a data-pjax="true" href="index.jsp"> <i class="fa fa-dashboard"></i> <span>仪表盘</span>
                </a></li>
                <li class="treeview"><a data-pjax="true" href="#"> <i class="fa fa-book"></i> <span>文章</span> <span
                        class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span> </a>
                    <ul class="treeview-menu">
                        <li><a data-pjax="true" href="post.jsp"> <i class="fa fa-circle-o"></i>所有文章 </a></li>
                        <li><a data-pjax="true" href="postnew.jsp"> <i class="fa fa-circle-o"></i>写文章 </a></li>
                        <li><a data-pjax="true" href="category.jsp"> <i class="fa fa-circle-o"></i>分类目录 </a></li>
                        <li><a data-pjax="true" href="tag.jsp"> <i class="fa fa-circle-o"></i>标签 </a></li>
                    </ul>
                </li>
                <li><a data-pjax="true" href="attachment.jsp"> <i class="fa fa-picture-o"></i> <span>附件</span> </a>
                </li>
                <li><a data-pjax="true" href="comment.jsp"> <i class="fa fa-comment"></i> <span>评论</span> </a></li>
                <li class="treeview"><a data-pjax="true" href="#"> <i class="fa fa-user-o"></i> <span>用户</span> <span
                        class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span> </a>
                    <ul class="treeview-menu">
                        <li><a data-pjax="true" href="userprofile.jsp"> <i class="fa fa-circle-o"></i>个人资料 </a></li>
                    </ul>
                </li>
            </ul>
        </section>
    </aside>
    <div class="content-wrapper">
        <style>
            .form-horizontal .control-label {
                text-align: left;
            }

            .third-part a {
                margin-right: 5px;
            }

            .icon-third-sina, .icon-third-qq, .icon-third-github {
                width: 32px;
                height: 32px;
            }

            .icon-third-qq {
                background-position: -112px -98px !important;
            }

            .icon-third-github {
                background-position: -186px -98px !important;
            }

            icon-third-sina, .icon-third-qq, .icon-third-github {
                background: url(images/bg_icons.png) no-repeat;
                display: inline-block;
            }
        </style>
        <section class="content-header">
            <h1>
                个人资料
                <small></small>
            </h1>
            <ol class="breadcrumb">
                <li>
                    <a data-pjax="true" href="/admin">
                        <i class="fa fa-dashboard"></i> 首页</a>
                </li>
                <li><a data-pjax="true" href="#">用户</a></li>
                <li class="active">个人资料</li>
            </ol>
        </section>
        <!-- tab选项卡 -->
        <section class="content container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="nav-tabs-custom">
                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a href="#general"
                                   data-toggle="tab">基本资料</a>
                            </li>
                            <li>
                                <a href="#pass"
                                   data-toggle="tab">密码修改</a>
                            </li>
                            <li>
                                <a href="#third"
                                   data-toggle="tab">第三方登录</a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active" id="general">
                                <form method="post" class="form-horizontal" id="profileForm">
                                    <input type="hidden" id="userPass" name="userPass"
                                           value="0585bd1bd5661ee3f3706c3e4fafcb04">
                                    <div class="box-body">
                                        <div class="form-group">
                                            <label for="userName"
                                                   class="col-lg-2 col-sm-4 control-label">用户名:
                                                <span data-toggle="tooltip" data-placement="top"
                                                      title="用于登录"
                                                      style="cursor: pointer">
<i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
                                            </label>
                                            <div class="col-lg-4 col-sm-8">
                                                <input type="text" class="form-control" name="userName"
                                                       value="xhz199838">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="userDisplayName"
                                                   class="col-lg-2 col-sm-4 control-label">显示名称:
                                                <span data-toggle="tooltip" data-placement="top"
                                                      title="页面显示的名称"
                                                      style="cursor: pointer">
<i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
                                            </label>
                                            <div class="col-lg-4 col-sm-8">
                                                <input type="text" class="form-control" id="userDisplayName"
                                                       name="userDisplayName" value="xhz199838">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="userEmail"
                                                   class="col-lg-2 col-sm-4 control-label">邮箱:</label>
                                            <div class="col-lg-4 col-sm-8">
                                                <input type="email" class="form-control" id="userEmail" name="userEmail"
                                                       value="1952683402@qq.com">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="userAvatar"
                                                   class="col-lg-2 col-sm-4 control-label">头像:</label>
                                            <div class="col-lg-4 col-sm-8">
                                                <div class="input-group">
                                                    <input type="text" class="form-control" id="userAvatar"
                                                           name="userAvatar"
                                                           value="http://cdn-blog.liuyanzhao.com/uploads/2019/3/2f47589650fe9a1bfcad50f771e50502">
                                                    <span class="input-group-btn">
<button class="btn btn-default " type="button"
        onclick="openAttach('userAvatar')">选择</button>
</span>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="userDesc"
                                                   class="col-lg-2 col-sm-4 control-label">个人说明:
                                            </label>
                                            <div class="col-lg-4 col-sm-8">
<textarea class="form-control" rows="3" id="userDesc" name="userDesc"
          style="resize: none"></textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="userEmail"
                                                   class="col-lg-2 col-sm-4 control-label">个人主页:</label>
                                            <div class="col-lg-4 col-sm-8">
                                                <input type="url" class="form-control" id="userSite" name="userSite"
                                                       value="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="box-footer">
                                        <button type="button" class="btn btn-primary btn-sm "
                                                onclick="saveUser('profileForm')">保存
                                        </button>
                                    </div>
                                </form>
                            </div>
                            <div class="tab-pane" id="pass">
                                <form method="post" class="form-horizontal" id="passForm">
                                    <div class="box-body">
                                        <div class="form-group">
                                            <label for="beforePass"
                                                   class="col-sm-2 control-label">原密码:</label>
                                            <div class="col-sm-4">
                                                <input type="password" class="form-control" id="beforePass"
                                                       name="beforePass">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="newPass"
                                                   class="col-sm-2 control-label">新密码:</label>
                                            <div class="col-sm-4">
                                                <input type="password" class="form-control" id="newPass" name="newPass">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="reNewPass"
                                                   class="col-sm-2 control-label">确认密码:</label>
                                            <div class="col-sm-4">
                                                <input type="password" class="form-control" id="reNewPass"
                                                       name="reNewPass">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="box-footer">
                                        <button type="button" class="btn btn-primary btn-sm "
                                                onclick="changPass()">修改
                                        </button>
                                    </div>
                                </form>
                            </div>
                            <div class="tab-pane" id="third">
                                <table class="table" id="bindList">
                                    <tbody>
                                    <tr>
                                        <th>服务</th>
                                        <th>绑定时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </tbody>
                                </table>
                                <div class="third-part">
                                    <p>您可以绑定以下第三方帐号，绑定后可使用第三方账号快速登录：</p>
                                    <a class="icon-third-qq"
                                       href="https://graph.qq.com/oauth2.0/authorize?response_type=code&amp;client_id=101547558&amp;redirect_uri=http://blog.liuyanzhao.com/oauth/qq/callback&amp;scope=get_user_info"
                                       target="_blank"></a>
                                    <a class="icon-third-github"
                                       href="https://github.com/login/oauth/authorize?client_id=793537eea96ebdd20b41&amp;redirect_uri=http://blog.liuyanzhao.com/oauth/github/callback&amp;state=abc"
                                       target="_blank"></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <script> $(function () {
            $('[data-toggle="tooltip"]').tooltip()
        });

        function openAttach(id) {
            layer.open({
                type: 2,
                title: '所有附件',
                shadeClose: true,
                shade: 0.5,
                maxmin: true,
                area: ['90%', '90%'],
                content: '/admin/attachment/select?id=' + id,
                scrollbar: false
            });
        }

        function saveUser(option) {
            var param = $('#' + option).serialize();
            $.ajax({
                type: 'post', url: '/admin/user/profile/save', data: param, success: function (data) {
                    if (data.code == 1) {
                        $.toast({
                            text: data.msg,
                            heading: '提示',
                            icon: 'success',
                            showHideTransition: 'fade',
                            allowToastClose: true,
                            hideAfter: 1000,
                            stack: 1,
                            position: 'top-center',
                            textAlign: 'left',
                            loader: true,
                            loaderBg: '#ffffff',
                            afterHidden: function () {
                                window.location.href = "/admin/logOut";
                            }
                        });
                    } else {
                        showMsg(data.msg, "error", 2000);
                    }
                }
            });
        }

        function changPass() {
            var beforePass = $('#beforePass').val();
            var newPass = $('#newPass').val();
            var reNewPass = $('#reNewPass').val();
            if (beforePass == "" || newPass == "" || reNewPass == "") {
                showMsg("请输入完整信息！", "info", 2000);
                return;
            }
            if (newPass != reNewPass) {
                showMsg("两次密码不一样！", "error", 2000);
                return;
            }
            var param = $('#passForm').serialize();
            $.ajax({
                type: 'post', url: '/admin/user/changePass', data: param, success: function (data) {
                    if (data.code == 1) {
                        $.toast({
                            text: data.msg,
                            heading: '提示',
                            icon: 'success',
                            showHideTransition: 'fade',
                            allowToastClose: true,
                            hideAfter: 1000,
                            stack: 1,
                            position: 'top-center',
                            textAlign: 'left',
                            loader: true,
                            loaderBg: '#ffffff',
                            afterHidden: function () {
                                window.location.reload();
                            }
                        });
                    } else {
                        showMsg(data.msg, "error", 2000);
                    }
                }
            });
        }

        function removeIt(bindId) {
            layer.confirm('你确定要删除？', function (index) {
                $.ajax({
                    type: 'POST',
                    url: '/admin/user/removeBind',
                    async: false,
                    data: {'bindId': bindId},
                    success: function (data) {
                        console.log(data);
                        if (data.code == 0) {
                            showMsg(data.msg, "error", 2000);
                        } else {
                            $('#bind-' + bindId).remove();
                            showMsg(data.msg, "success", 2000);
                        }
                    }
                });
                layer.close(index);
            });
        } </script>
    </div>
    <footer class="main-footer">
        <div class="pull-right hidden-xs"><a target="_blank" href="#">1.0.0</a></div>
        Thanks for using <strong><a data-pjax="true" href="/admin/sens">SENS</a>.</strong>
    </footer>
</div>
<script src="js/jquery.pjax.js"></script>
<script src="js/pace.min.js"></script>
<script src="js/adminlte.min.js"></script>
<script src="js/jquery.toast.min.js"></script>
<script src="js/layer.js"></script>
<script src="js/fileinput.min.js"></script>
<script src="js/froala_editor.pkgd.min.js"></script>
<script src="js/zh_cn.js"></script>
<script src="js/image_manager.min.js"></script>
<script src="js/codemirror-4.inline-attachment.min.js"></script>
<script src="js/jquery.tag-editor.min.js"></script>
<script src="js/jquery.caret.min.js"></script>
<script src="js/jquery.hz2py-min.js"></script>
<script src="js/zh.min.js"></script>
<script src="js/app.js"></script>
<script> Pace.options = {restartOnRequestAfter: false};
$(document).ajaxStart(function () {
    Pace.restart();
});
$(document).pjax('a[data-pjax=true]', '.content-wrapper', {fragment: '.content-wrapper', timeout: 8000});
var heading = "提示"; </script>
</body>
</html>